package com.study.interface_demo3;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        //目标：班级学生管理系统
        //1、每个学生是一个对象，所以先定义学生类，用于创建学生对象，封装学生数据
        //2、定义接口：ClassData
        //3、定义两套实现类，来分别处理，以便解耦合
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student("木婉清",'女',80));
        students.add(new Student("钟灵",'女',95));
        students.add(new Student("王语嫣",'女',75));
        students.add(new Student("西夏公主",'女',100));
        students.add(new Student("虚竹",'女',90));
        students.add(new Student("乔峰",'男',100));
        students.add(new Student("段誉",'男',80));

        ClassData cd1 = new ClassDataImpl1(students);
        cd1.printAllStudentsInfo();
        cd1.printAllStudentsAverageScore();
        System.out.println("=========================================");
        ClassData cd2 = new ClassDataImpl2(students);
        cd2.printAllStudentsInfo();
        cd2.printAllStudentsAverageScore();
    }
}
